<template>
  <div>
    <template v-if="item.children && item.children.length === 0">
      <el-menu-item :key="item.id" :index="item.path">
        {{item.name}}
      </el-menu-item>
    </template>
    <el-submenu v-else :index="item.id" style="text-align: left">
      <span slot="title">
        <i :class="item.icon"></i>
        {{item.name}}
      </span>
      <template v-for="child in item.child">
        <item v-if="child.children && child.children.length>0" :key="child.id" :item="child"/>
        <el-menu-item v-else :key="child.id" :index="child.path">
          {{child.name}}
        </el-menu-item>
      </template>
    </el-submenu>
  </div>
</template>

<script>
export default {
  props: ["item"],
  name: "item",
  data() {
    return {};
  },
  mounted() {},
  methods: {},
};
</script>

<style scoped >
</style>
